{{!

  Copyright (c) Meta Platforms, Inc. and affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

}}
{{#let export partial render_enum |enum trailing_comma?|}}
  "{{enum.name}}" : {
    "name" : "{{enum.name}}",
    {{#each (array.enumerate enum.values with_first=true with_last=true) as |index enum_value first? last?|}}
    {{#if first?}}
    {{! Before the first entry, open the object}}
    "constants" : {
    {{/if first?}}
      "{{enum_value.name}}" : {
        "name" : "{{enum_value.name}}",
        {{#if enum_value.docs?}}
        "docstring" : {{enum_value.docstring}},
        {{/if enum_value.docs?}}
        "lineno" : {{enum_value.lineno}},
        "value" : {{enum_value.value}}
      }{{#if (not last?)}},{{#else}}
    {{! After the last entry, close the object on a new line}}
    },{{/if (not last?)}}
    {{/each}}
    {{#if enum.docs?}}
    "docstring" : {{enum.docstring}},
    {{/if enum.docs?}}
    "lineno" : {{enum.lineno}}
  }{{#if trailing_comma?}},{{/if}}
{{/let partial }}
